﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace WPFChat
{
    public class GenericTemplateSelector : DataTemplateSelector
    {
        public Dictionary<object, DataTemplate> Selectors { get; private set; }

        public GenericTemplateSelector()
        {
            Selectors = new Dictionary<object, DataTemplate>();
        }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (Selectors.ContainsKey(item))
                return Selectors[item];

            return base.SelectTemplate(item, container);
        }
    }
}
